import request from './request'

// 获取订单列表
export function getOrderList(params) {
  return request({
    url: '/orders',
    method: 'get',
    params
  })
}

// 获取订单详情
export function getOrderDetail(id) {
  return request({
    url: `/orders/${id}`,
    method: 'get'
  })
}

// 确认收货
export function confirmReceiveOrder(id) {
  return request({
    url: `/orders/${id}/confirm`,
    method: 'put'
  })
}

// 取消订单
export function cancelOrder(id, reason) {
  return request({
    url: `/orders/${id}/cancel`,
    method: 'put',
    data: { reason }
  })
}

// 提交订单评价
export function submitOrderComment(id, data) {
  return request({
    url: `/orders/${id}/comment`,
    method: 'post',
    data
  })
}

// 支付订单
export function payOrder(id, paymentMethod) {
  return request({
    url: `/orders/${id}/pay`,
    method: 'post',
    data: { paymentMethod }
  })
}

// 获取物流信息
export function getOrderLogistics(id) {
  return request({
    url: `/orders/${id}/logistics`,
    method: 'get'
  })
}

// 获取订单统计信息
export function getOrderStats() {
  return request({
    url: '/orders/stats',
    method: 'get'
  })
} 